Build report, console modes, and warning control - #12572
Draft
gnodet wants to merge 2 commits into
Draft
Conversation
4 tasks
gnodet
force-pushed
the
feature/12571-build-report
branch
6 times, most recently
from
July 29, 2026 14:59
3192bb4 to
87be78e
Compare
This was referenced Jul 31, 2026
…s, warning control Add a comprehensive build reporting infrastructure to Maven 4.1.0: **Structured Build Report** (Phase 0-1) - BuildReport API in maven-api-core with ModuleReport, MojoReport, FailureReport, and LogEvent data model - BuildReportCollector EventSpy that captures lifecycle events, per-mojo log output, and build diagnostics - JSON writer producing timestamped build-report-*.json files - Deduplicated warning summary printed at end of build **Console Modes** (Phase 2-4) - ConsoleMode enum (AUTO/PLAIN/RICH/MACHINE) with --console CLI flag - PlainBuildEventListener for compact CI output - RichBuildEventListener with JLine status bar for interactive terminals - MachineBuildEventListener for JSON-lines structured output **Warning Control** (Phase 5) - --warning-mode CLI flag (ALL/SUMMARY/NONE) - Log.warn() interception for automatic Maven 3 plugin coverage - -Dmaven.diagnostic.suppress=key for selective suppression **Build Log Viewer** (mvnlog) - mvnlog CLI tool for post-build report inspection - --json flag for raw JSON output - Shell scripts for Unix and Windows **Plugin API** (DiagnosticReporter) - BuilderProblem.builder() static factory with fluent Builder API - DiagnosticReporter Service interface for Maven 4 plugins - DefaultDiagnosticReporter implementation with auto-discovery Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
force-pushed
the
feature/12571-build-report
branch
from
July 31, 2026 11:57
d7bb105 to
63da8ce
Compare
This was referenced Jul 31, 2026
gnodet
added a commit
that referenced
this pull request
Aug 4, 2026
Port and modernize the incremental build context from PR #1118, building on the original Sonatype plexus-build-api / Takari incrementalbuild work. API (maven-api-core): - BuildContext: register inputs, check status, associate outputs, skip execution, automatic stale output cleanup - SPI: Workspace (NORMAL/ESCALATED/SUPPRESSED), CommittableBuildContext, BuildContextEnvironment, BuildContextFinalizer - Diagnostic messages are NOT part of this API — use DiagnosticReporter from the build report API instead Implementation (maven-impl): - DefaultBuildContext with timestamp/size change detection - State serialization for cross-build persistence - PathMatcherFactory integration for Ant-style patterns - 36 tests Maven integration (maven-core): - MojoExecutionScoped DI wiring - ClasspathDigester + MojoConfigurationDigester for automatic configuration change detection - MavenBuildContextFinalizer for post-mojo commit - maven.buildcontext.skip property to disable entirely - Performance: released-artifact digest bypass, no-op state skip, single-syscall file status, field reflection cache Based on #12572 (Build Report Foundation). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the reactor has more modules than fit as individual ✓/●/○ indicators on the terminal width, switch to a full-width proportional progress bar: green ━ for completed, yellow ━ for active, dim ─ for remaining, with the counter and elapsed time appended. The progress bar replaces the separator line — one line instead of two (no redundant horizontal rule above the bar). This also gives an extra project slot line to the status area. Small reactors (≤ maxIndicators) keep the per-module indicators with the separate separator line, where each module gets its own symbol. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
force-pushed
the
feature/12571-build-report
branch
from
August 4, 2026 22:33
83ce6ac to
6fd5983
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build Report Foundation
What users see
--console=plain— compact CI output (default whenCI=true)One line per completed module, no ANSI, no status bar. Auto-selected on CI (
CI=true,JENKINS_URL, etc.):--console=rich— live status bar (default on interactive TTY)During the build, the bottom of the terminal shows a live JLine status area that updates in place. All plugin INFO/WARN output is suppressed — only ERRORs scroll above the status bar:
With large reactors (where per-module indicators don't fit), the separator becomes a proportional progress bar:
At the end, the status bar is torn down and replaced with a compact summary:
When diagnostics are present:
--console=machine— JSON lines for tools and LLM agentsOne JSON object per line, designed for piping to
jq, IDE integrations, and AI agents:--console=verbose— full output (Maven 4.0 default)Unchanged from today's Maven 4.0 behavior — all per-mojo banners, plugin output, download progress:
--console=auto(the default)Selects automatically:
CI=trueorJENKINS_URLset →plain; interactive TTY →rich; otherwise →verbose.Warning summary at end of build
All console modes show a deduplicated warning summary at end of build (unless
--warning-mode=none):--warning-modecontrols behavior:all(default)summarynonefailVersion info on failure
When the build fails, Maven and Java version are printed to help with bug reports:
Structured build report JSON
Every build writes
target/build-reports/build-report-latest.json:{ "formatVersion": 1, "status": "SUCCESS", "duration": "PT5.535S", "startTime": "2026-08-06T05:58:15.816Z", "mavenVersion": "4.1.0-SNAPSHOT", "javaVersion": "21.0.11", "goals": ["validate"], "project": "org.apache.maven:maven:4.1.0-SNAPSHOT", "multiModule": true, "threads": 1, "modules": [ { "groupId": "org.apache.maven", "artifactId": "maven", "version": "4.1.0-SNAPSHOT", "status": "SUCCESS", "duration": "PT0.577S", "mojos": [ { "plugin": "maven-enforcer-plugin", "goal": "enforce", "phase": "validate", "status": "SUCCESS", "duration": "PT0.346S", "output": [...] } ] } ] }mvnlog— build report viewerAfter a build completes,
mvnlogreads the report JSON and renders a human-readable view:How it works
Console mode architecture
Each console mode is a pair of cooperating classes:
BuildEventListenerExecutionListenerrichRichBuildEventListener(JLine status bar)RichExecutionEventLogger(suppress per-mojo banners)plainPlainBuildEventListener(no-op status)PlainExecutionEventLogger(one line per module)machineMachineBuildEventListener(JSON log/transfer events)MachineExecutionEventLogger(JSON lifecycle events)verboseSimpleBuildEventListenerExecutionEventLoggerThe
BuildEventListenerhandles real-time events (log messages, transfer progress), while theExecutionListenerhandles lifecycle events (session/project/mojo start/finish).Build report pipeline
BuildReportCollector— injectedExecutionListenerthat captures every lifecycle event, mojo execution, and log message into an in-memory reportBuildReportWriter— writes the report totarget/build-reports/build-report-latest.jsonat session endBuilderProblem— universal diagnostic currency: model validation warnings, plugin validation, and (with PR Fix #12643: Pipe structured BuilderProblems into DiagnosticCollector #12647) plugin-reported diagnostics all flow throughBuilderProblemintoDiagnosticCollectorWarning deduplication
Warnings are deduplicated by key (e.g.
pom:version-expression) and counted. The end-of-build summary shows each unique warning with its count, regardless of how many modules triggered it.DiagnosticReporter (PR #12647)
A new Maven 4 API service that plugins can inject to report structured diagnostics:
BuilderProblemobjects with severity, key, source location, suggestion, and documentation URLcompiler:unchecked:src/Foo.java:42) prevent duplicate warnings from incremental buildsFollow-up PRs
DiagnosticReporterAPI: injectable service for Maven 4 plugins to report structuredBuilderProblemobjectsBuilderProblemwith per-location dedup keys